package com.gudaomai.ekproject.common;

import java.io.FileInputStream;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Component;
@Component
public class AppContext {

	
	
	private static String class_path =Thread.currentThread().getContextClassLoader().getResource("").getPath();
	public static String html_path="html.path";
	private static Properties p = new Properties();
	public static String pic_path = "pic.path";
	public static String pic_url = "pic.url";
	public static String file_path = "file.path";
	public static String file_url = "file.url";
	public static String expfile_path = "expfile.path";
	public static String expfile_url = "expfile.url";
	
	public static String search_path = "search.path";
	public static String domain_url="domain.url";
	public static String ueditor_path="ueditor.path";
	public static String debug="debug";
	public static String wapstatic="wap-static";

	
	public static int adminSettingflg =0; 
	
	
	AppContext() {
	}
	 static {
//			Properties p = new Properties();

			//Properties p = new Properties();

				try {
					p.load(new FileInputStream(class_path + "config.properties"));
					html_path = p.getProperty("html.path");
				} catch (IOException e) {
					Logger.getRootLogger().error(e.getStackTrace());
					e.printStackTrace();
				}
				
	}

	public static String getProperty(String key) {
		return p.getProperty(key);
	}
	
	public static Map getPropertys() {
		Map map = new HashMap<String, String>();
		for (final String name: p.stringPropertyNames())
		    map.put(name, p.getProperty(name));
		
		return map;
	}
	
}
